<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML" 4.01"//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!-- Created: August 15, 2001-->
<!--
$Id: SurveyAddRec.php,v 1.11 2001/11/02 19:13:33 eugenem Exp $
$Header: /export/home/eugenem/public_html/ComplianceReports/RCS/SurveyAddRec.php,v 1.11 2001/11/02 19:13:33 eugenem Exp $
$Log: SurveyAddRec.php,v $
Revision 1.11  2001/11/02 19:13:33  eugenem
*** empty log message ***

Revision 1.10  2001/11/02 19:10:35  eugenem
Moved HTTP_*_VARS processing to dbc.inc

Revision 1.9  2001/11/02 15:00:32  eugenem
Moved database connect statements to a separate file.

Revision 1.8  2001/10/18 15:02:49  eugenem
Record timestamp entry when entering a new recommendation

Revision 1.7  2001/10/18 13:41:36  eugenem
Check $SurveyID with empty() instead of isset() when setting up SELECT box.

Revision 1.6  2001/09/25 19:34:05  eugenem
Make the Survey select box remember the last SurveyID used.

Revision 1.5  2001/09/19 13:45:41  eugenem
Revert to previous method of selecting SurveyID from TestDates table.  Getting it from Recommendations didn't get scheduled SurveyIDs with no recommendations.  duh.

Revision 1.4  2001/09/18 21:11:27  eugenem
Get SurveyID from Recommendations table instead of TestDates.  Filter out all surveyIDs where Resolved status is 1.

Revision 1.3  2001/09/04 21:38:57  eugenem
Changed structure of Recommendations table.

Revision 1.2  2001/08/21 15:56:33  eugenem
Fixed bug where I was trying to insert MachineID instead of SurveyID into the Recommendations table

Revision 1.1  2001/08/16 18:28:37  eugenem
Initial revision

Revision 1.1  2001/08/15 17:03:52  eugenem
Initial revision

-->

<html>
<head>
<title>Radiological Equipment Database</title>
<meta name="author" content="Eugene Mah" />
<link rev="made" href="mailto:eugenem@ix.netcom.com" />
<link rev="home" href="http://blog.imabug.net" />
<meta name="description" content="" />
<meta name="Keywords" content="" />
<meta name="Reply-to" content="eugenem@ix.netcom.com" />
<META http-equiv="PICS-Label" content='(PICS-1.1 "http://www.classify.org/safesurf/" l r (SS~~0001))' />
<?PHP
require('functions.inc');
require('dbc.inc');

?>
</head>

<body>
<h1>Radiological Equipment Database</h1>
<?PHP
if (isset($SurveyID) && $submit) {
  // Escape any quotes in $Recommendation
  $Recommendation = addslashes($Recommendation);
  if (empty($Resolved)) {
    $query = "INSERT INTO Recommendations (SurveyID,Recommendation,Resolved,RecStatus,RecAddTS)
            VALUES ($SurveyID,\"$Recommendation\",0,\"New\",now())";
  }
  else {
    $query = "INSERT INTO Recommendations (SurveyID,Recommendation,Resolved,RecStatus,RecAddTS,RecResolveTS,RecResolveDate,ResolvedBy)
            VALUES ($SurveyID,\"$Recommendation\",1,\"Complete\",now(),now(),curdate(),\"$ResolvedBy\")";
  }
  $result = mysql_query($query)
    or die ("Insert query: $query failed<br>\n");

  echo "<h2>Recommendation added</h2>\n";
  echo "<p>$Recommendation for Survey $SurveyID has been added</p>\n";
}
?>
<h2>Add Recommendation</h2>
<form action="SurveyAddRec.php" method="POST">
<p>Enter Survey ID: <input name="SurveyID" type="text" size="5" value="<?php echo (isset($SurveyID)||!empty($SurveyID))?$SurveyID:""; ?>" ></p>
<?PHP
/* 2004-11-22: Don't do this anymore.  These drop boxes are starting to get too long.
$survID = mysql_query("select SurveyID from TestDates");
if (empty($SurveyID)) $SurveyID="";
echo listbox_one_field($survID,"SurveyID",$SurveyID);
*/
?>

<p>
<input type="CHECKBOX" name="Resolved" value="1" /><textarea name="Recommendation" rows="3" cols="70">Enter recommendation</textarea><br />
Biomed Work Order Number: <input name="WONum" type="text" size="20" maxlength="20" /><br />
Resolution date: <input name="RecResolveDate" type="text" size="20" maxlength="20" /><br />
Resolved by: <input name="ResolvedBy" type="text" size="20" maxlength="20" />
</p>
<!-- A small menu -->
<p>
<input type="SUBMIT" name="submit" value="Add Recommendations"> /
<input type="RESET" value="Reset"> /
<a href="index.html" target="_top" >Main</a></p>
</form>
<?PHP
/*
  This is processed if we already have info about a survey
  (i.e. we have entered the form again after submitting survey info).
  In this case, data on the survey has already been inserted into the
  database, and now the next step is to either enter data from
  the generator check or enter any recommendations from the survey.

  $SurveyID and $MachID are passed to the next form using HIDDEN
  form elements
*/
if (isset($MachID)) {
  echo "<form action=\"SurveyGenData.php\" method=\"POST\">\n";
  echo "<input type=\"HIDDEN\" name=\"SurveyID\" value=\"$SurveyID\">\n";
  echo "<input type=\"BUTTON\" value=\"Add Generator data\" name=\"AddGenData\"> \n";
  echo "</form>";
  echo "<form action=\"SurveyAddRec.php\" method=\"POST\">\n";
  echo "<input type=\"HIDDEN\" name=\"SurveyID\" value=\"$SurveyID\">\n"; 
  echo "<input type=\"BUTTON\" value=\"Add Recommendations\" name=\"AddRec\">\n";
  echo "</form>\n";
}

mysql_close();
?>
</body>
</html>
